<template>
  <footer class="footer">
    <span class="todo-count">
      剩余
      <strong>{{ arr.length}}</strong>
    </span>
    <ul class="filters" @click="fn">
      <li>
        <a :class="{selected:isSel==='all'}" href="javascript:;" @click="isSel='all'">全部</a>
      </li>
      <li>
        <a :class="{selected:isSel==='yes'}" href="javascript:;" @click="isSel='yes'">未完成</a>
      </li>
      <li>
        <a :class="{selected:isSel==='no'}" href="javascript:;" @click="isSel='no'">已完成</a>
      </li>
    </ul>
    <button class="clear-completed" @click="claerfn">清除已完成</button>
  </footer>
</template>

<script>
export default {
  data() {
    return {
      isSel: "all" //全部all  完成yes  未完成no
    };
  },
  props: {
    arr: {
      type: Array
    }
  },
  methods: {
    fn() {
      // 1.把类型字符传给父亲
      this.$emit("change", this.isSel);
    },
    claerfn() {
      this.$emit('clear')
    }
  }
};
</script>